﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.NodeFormData.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.Api
{
    [ApiRouteName("/flow/app/form/{name}")]
    internal class FlowAppFormRelationApi : ApiController
    {
        private readonly IFlowAppFormRelationService _Service;

        public FlowAppFormRelationApi ( IFlowAppFormRelationService service )
        {
            this._Service = service;
        }

        public DataRelation[] Gets ( [NumValidate("flow.app.id.error", 1)] long appId )
        {
            return this._Service.Gets(appId);
        }

        public void Sync ( LongNullParam<DataRelation[]> param )
        {
            this._Service.Sync(param.Id, param.Value);
        }
    }
}
